<!--
 * @Date: 2020-07-08 16:10:27
 * @LastEditors: leehave
 * @LastEditTime: 2020-09-04 11:21:18
-->
<template>
  <div id="app">
    <router-view class="router" />
  </div>
</template>

<script>
export default {
  name: "App",
  created(){
    this.handleFocusOut(),
    this.handleResize()
  },
  methods: {
    handleFocusOut() {
      document.addEventListener("focusout", () => {
        document.body.scrollTop = 0;
      });
    },
    handleResize() {
      const clientHeight = document.documentElement.clientHeight;
      const resizeHandler = () => {
        const tagName = document.activeElement.tagName;
        if (tagName) {
          const inputBox = tagName === "INPUT" || tagName === "TEXTAREA";
          if (inputBox) {
            setTimeout(() => {
              document.activeElement.scrollIntoView();
            }, 0);
          }
        }
        const bodyHeight = document.documentElement.clientHeight;
        const ele = document.getElementById("fixed-bottom");
        if (ele) {
          if (clientHeight > bodyHeight) ele.style.display = "none";
          else ele.style.display = "block";
        }
      };
      window.addEventListener("resize", resizeHandler);
    }
  },
  components: {}
};
</script>

<style>
#app{
  min-height: 100%;
  padding-bottom: 50px;
}
.kejue-view{
  min-height: 100%;
  height: 100%;
}
</style>
